import { request } from "umi";

/** 获取用户列表 */
export function getUserList(params?: any): Promise<Types.Http.Response<Types.User.IUserInfo[]>> {
  return request(`/api/user/list`, { params });
}

/**
 * 用户详情
 * @param params
 * @returns
 */
export function getUserDetail(params?: {
  id: string;
}): Promise<Types.Http.Response<Types.User.IUserInfo>> {
  return request(`/api/user/detail`, { params });
}

/**
 * 新增用户
 * @param params
 * @returns
 */
export function addUser(
  data: Types.User.IUserInfo
): Promise<Types.Http.Response<Types.User.IUserInfo>> {
  return request(`/api/user/add`, { data, method: "post" });
}

/**
 * 用户详情
 * @param params
 * @returns
 */
export function editUser(
  data: Types.User.IUserInfo
): Promise<Types.Http.Response<Types.User.IUserInfo>> {
  return request(`/api/user/edit`, { data, method: "post" });
}
